The aspect ratio of A4 paper is different from standard specifications. #95#96
Open
asylee02 wants to merge 2 commits intodatalab-to:devfrom
Open
The aspect ratio of A4 paper is different from standard specifications. #95#96asylee02 wants to merge 2 commits intodatalab-to:devfrom
asylee02 wants to merge 2 commits intodatalab-to:devfrom
Conversation
Independent rounding of w_blocks and h_blocks can push them in opposite directions (one up, one down), distorting the aspect ratio. For A4 at 192 DPI this produces 1.403 instead of 1.4142. Derive h_blocks from the already-rounded w_blocks so both axes are quantized consistently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When converting an A4 PDF, the rendered image has an aspect ratio of ~1.403
instead of the expected 1.4142, due to grid quantization in
scale_to_fit.Root Cause
Step 1 —
input.py: load_pdf_imagesrenders A4 correctly at 192 DPI:Step 2 —
model/util.py: scale_to_fitsnaps to multiples ofgrid_size=28: